﻿<%@ Page Language="VB" AutoEventWireup="true" CodeFile="adduser.aspx.vb" Inherits="MovieTixStaff_adduser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

</script>
<%--This below code from the website:http://ramanisandeep.wordpress.com/2008/11/07/hide-an-aspnet-label-control-after-a-few-seconds/--%>
<script type="text/javascript">
    self.setInterval("changeValue()", 5000);

    function changeValue() {
        document.getElementById("Label1").innerText = "";

    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css">
html
{
    background-color:Black;
    color:White;
    padding-left:40px;
}
</style>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:Label ID="lblId" runat="server" Visible="false" ></asp:Label>
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <ContentTemplate>
 
      <asp:Label id="Msg" ForeColor="maroon" runat="server" />
      
         
       <asp:Label ID="Label1"   runat="server" Font-Bold="True" Font-Size="Larger"  
            ForeColor="#FFFFCC"></asp:Label>   <br />
         
    <asp:Label ID="Label6" runat="server" Text="Please complete the following form: " Font-Bold="True" Font-Size="Large" ForeColor="#CCFFFF"></asp:Label><br />
        <br />
        <asp:Label ID="Label4" runat="server" Text="" Visible="false"></asp:Label>
            <asp:Label ID="Label2" runat="server" Text="" Visible="false"></asp:Label>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
   

 <asp:UpdatePanel ID="UpdatePanel2"   runat="server">
        <ContentTemplate>
    
         
      <table>  
     <tr><td><asp:Label ID="Label3" runat="server" Text="Please select a theatre"></asp:Label> </td>      
<td>
  
<asp:DropDownList id="theatre2"     DataSourceID="theatre" DataTextField="theatrename"   DataValueField="Theatreid" runat="server" >
</asp:DropDownList>


       
 <asp:SqlDataSource id="theatre" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT  [TheatreId], [TheatreName] FROM [Theatre]" />
               
                
                 </td></tr>
            </table>           
    </ContentTemplate></asp:UpdatePanel>   
      <%--  <asp:CreateUserWizard ID="CreateUserWizard1" OnCreatedUser="test"   UserNameRequiredErrorMessage="Required"   InstructionText="Please complete the following form:"  ContinueDestinationPageUrl="~/MovieTixStaff/AddTheatre.aspx"     LoginCreatedUser="false"   runat="server">
     <WizardSteps>
                <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
             <ContentTemplate>
      
        <table align="left" width="400px">  


<tr><td >     <asp:Label id="lblUserName" Text="User Name:" AssociatedControlID="UserName" Runat="server" /></td>

<td>   <asp:TextBox  id="UserName" Runat="server" />

</td><asp:RequiredFieldValidator ID="Required2" ControlToValidate="UserName"
    runat="server" ErrorMessage="Required"/></tr>

   <tr><td><asp:Label id="lblPassword" Text="Password:" AssociatedControlID="Password" Runat="server" /></td>

 <td>  <asp:TextBox id="Password" TextMode="Password" Runat="server" /><asp:RequiredFieldValidator ID="Required3" ControlToValidate="Password"
    runat="server" ErrorMessage="Required"/></td></tr>
<tr><td>
 <asp:Label id="lblEmail" Text="Email:" AssociatedControlID="Email" Runat="server" /></td>
<td>   <asp:TextBox id="Email" Runat="server" /><asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="Email"
    runat="server" ErrorMessage="Required"/></td></tr>

<tr><td> <asp:Label id="lblQuestion" Text="Security Question:"  AssociatedControlID="Question" Runat="server" /></td>
<td><asp:DropDownList id="Question" Runat="server">
      <asp:ListItem  Text="Enter the name of your pet" Value="Pet Name" />
<asp:ListItem  Text="Enter your favorite color" Value="Favorite Color" />
        </asp:DropDownList></td></tr> 

<tr><td> <asp:Label id="lblAnswer" Text="Security Answer:" AssociatedControlID="Answer" Runat="server" /></td>

    <td>    <asp:TextBox id="Answer"  Runat="server" /><asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="Answer"
    runat="server" ErrorMessage="Required"/></td></tr>          
          
    </table>  
            

               </ContentTemplate>

               </asp:CreateUserWizardStep>
               
               <asp:CompleteWizardStep>
               <ContentTemplate>
               The Account is created successfully<br />
                   <asp:Button ID="Button1" runat="server"  PostBackUrl="~/MovieTixStaff/adduser.aspx" Text="Button" />
               
             </ContentTemplate>
               </asp:CompleteWizardStep>
      </WizardSteps>
        </asp:CreateUserWizard>--%>
 


  <table cellpadding="3" border="0">
    <tr>
      <td>Username:</td>
      <td><asp:Textbox  id="UsernameTextbox" OnTextChanged="Clear"   runat="server" /></td>
      <td><asp:RequiredFieldValidator id="UsernameRequiredValidator" runat="server"
                                      ControlToValidate="UserNameTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" />
    <asp:CustomValidator  ID="CustomValidator1"  ControlToValidate="UsernameTextbox"  OnServerValidate="function1"  runat="server" Text="This username already exist, please try another" ErrorMessage="CustomValidator" />                         
                                      
                                      
                                      
                                      </td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><asp:Textbox id="PasswordTextbox" runat="server" TextMode="Password" /></td>
      <td><asp:RequiredFieldValidator id="PasswordRequiredValidator" runat="server"
                                      ControlToValidate="PasswordTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" /></td>
    </tr>
    <tr>
      <td>Confirm Password:</td>
      <td><asp:Textbox id="PasswordConfirmTextbox" runat="server" TextMode="Password" /></td>
      <td><asp:RequiredFieldValidator id="PasswordConfirmRequiredValidator" runat="server"
                                      ControlToValidate="PasswordConfirmTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" />
          <asp:CompareValidator id="PasswordConfirmCompareValidator" runat="server"
                                      ControlToValidate="PasswordConfirmTextbox" ForeColor="red"
                                      Display="Static" ControlToCompare="PasswordTextBox"
                                      ErrorMessage="Confirm password must match password." />
      </td>
    </tr>
    <tr>
      <td>Email Address:</td>
      <td><asp:Textbox id="EmailTextbox" runat="server" /></td>
      <td><asp:RequiredFieldValidator id="EmailRequiredValidator" runat="server"
                                      ControlToValidate="EmailTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" /></td>
    </tr>


<% If Membership.RequiresQuestionAndAnswer Then %>

    <tr>
      <td>Password Question:</td>
      <td><asp:Textbox id="PasswordQuestionTextbox" runat="server" /></td>
      <td><asp:RequiredFieldValidator id="PasswordQuestionRequiredValidator" runat="server"
                                      ControlToValidate="PasswordQuestionTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" /></td>
    </tr>
    <tr>
      <td>Password Answer:</td>
      <td><asp:Textbox id="PasswordAnswerTextbox" runat="server" /></td>
      <td><asp:RequiredFieldValidator id="PasswordAnswerRequiredValidator" runat="server"
                                      ControlToValidate="PasswordAnswerTextbox" ForeColor="red"
                                      Display="Static" ErrorMessage="Required" /></td>
    </tr>

<% end If %>


    <tr>
      <td></td>
      <td><asp:Button id="CreateUserButton" Text="Create User" OnClick="CreateUser_OnClick" runat="server" /></td>
    </tr>
    
  </table>
  </ContentTemplate>
             </asp:UpdatePanel>



















        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            InsertCommand="INSERT INTO [TheatreStaff] ([TheatreStaffUserName], [TheatreId]) VALUES (@TheatreStaffUserName, @TheatreId)"  >

            <InsertParameters>
                <asp:Parameter Name="TheatreStaffUserName" Type="String" />
                <asp:Parameter Name="TheatreId" Type="Int16" />
            </InsertParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
